/**
 * Created by Cake on 2017/5/25.
 */

$(function () {

    var square = $('header').height() + $('footer').height();
    $('section').loadScroller({
        square: square,
        scrollOver: function () {
            console.log(1);
            scrollFlag = true;
        }
    });

    var domProvince = $('.province');
    if (domProvince.length > 0) {
        domProvince.mobiscroll().select({
            theme: 'mobiscroll',
            mode: 'scroller',
            display: 'bottom',
            lang: 'zh',
            placeholder: '请选择项目所在省',
            headerText:"项目所在省",
            onInit: function() {
                domProvince
                    .val('')
                    .prev().val('');
            }
        });
    }

    var domCity = $('.city');
    if (domCity.length > 0) {
        domCity.mobiscroll().select({
            theme: 'mobiscroll',
            mode: 'scroller',
            display: 'bottom',
            lang: 'zh',
            placeholder: '请选择项目所在市',
            headerText:"项目所在市",
            onInit: function() {
                domCity
                    .val('')
                    .prev().val('');
            }
        });
    }

    var domArea = $('.area');
    if (domArea.length > 0) {
        domArea.mobiscroll().select({
            theme: 'mobiscroll',
            mode: 'scroller',
            display: 'bottom',
            lang: 'zh',
            placeholder: '请选择项目所在区',
            headerText:"项目所在区",
            onInit: function() {
                domArea
                    .val('')
                    .prev().val('');
            }
        });
    }

    var selectProvince = $('.select-province');
    if (selectProvince.length > 0) {
        selectProvince.mobiscroll().select({
            theme: 'mobiscroll',
            mode: 'scroller',
            display: 'bottom',
            lang: 'zh',
            placeholder: '请选择项目所在省',
            headerText:"项目所在省",
            onInit: function() {
                selectProvince
                    .val('')
                    .prev().val('');
            }
        });
    }

    var selectCity = $('.select-city');
    if (selectCity.length > 0) {
        selectCity.mobiscroll().select({
            theme: 'mobiscroll',
            mode: 'scroller',
            display: 'bottom',
            lang: 'zh',
            placeholder: '请选择项目所在市',
            headerText:"项目所在市",
            onInit: function() {
                selectCity
                    .val('')
                    .prev().val('');
            }
        });
    }

    var selectArea = $('.select-area');
    if (selectArea.length > 0) {
        selectArea.mobiscroll().select({
            theme: 'mobiscroll',
            mode: 'scroller',
            display: 'bottom',
            lang: 'zh',
            placeholder: '请选择项目所在区',
            headerText:"项目所在区",
            onInit: function() {
                selectArea
                    .val('')
                    .prev().val('');
            }
        });
    }

    var domTime = $('.time');
    if (domTime.length > 0) {
        domTime.mobiscroll().date({
            theme: 'mobiscroll',
            display: 'bottom',
            dateFormat: 'yy-mm-dd',
            headerText: '创建时间',
            lang: 'zh'
        });
    }

});